package com.magima.core.instrument;

import com.magima.core.instrument.FinishListener;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class InstrumentedActivity extends Activity {
	public static String TAG = "IntrumentedPlayer";
	public static String CLASS_STARTED = "com.magima.wrath.StartActivity";

	private FinishListener mListener;

	public void setFinishListener(FinishListener listener) {
		mListener = listener;
	}

	@Override
	protected void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		try {
			Intent intent;
			intent = new Intent(this, Class.forName(CLASS_STARTED));
			intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(intent);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onDestroy() {
		if (mListener != null) {
			mListener.onActivityFinished();
		}
	}

}
